'use strict';

const Controller = require('egg').Controller;

class VerifyController extends Controller {
  async verify() {
    const { ctx, service } = this;
    // 服务里面的方法
    const captcha = await service.verify.captcha();
    // 返回的类型
    ctx.response.type = 'image/svg+xml';
    // {data: '<svg.../svg>', text: 'abcd'}
    console.log(ctx.session.code);
    ctx.body = captcha.data;
  }
}

module.exports = VerifyController;
